extends Node2D

const MAX_SPEED = 130
const ACCELERATION = 300
const FRICTION = 218

var velocity = 0.0



# Called when the node enters the scene tree for the first time.
func _ready() -> void:
	pass




# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
	pass
		
func _physics_process(delta: float) -> void:
	var horizontal_dir = (Input.get_action_strength("rotate_right") - Input.get_action_strength("rotate_left"))
	
	if horizontal_dir != 0:
		velocity += ACCELERATION * delta * horizontal_dir
		if velocity > 0:
			velocity = minf(velocity, MAX_SPEED)
		elif velocity < 0:
			velocity = maxf(velocity, -MAX_SPEED)
	else:
		velocity = move_toward(velocity, 0.0, FRICTION * delta)
	rotation_degrees += velocity * delta
	
#
